package com.note.simpleadmin.module.shop.dao;

import com.note.simpleadmin.entity.TbGoods;
import com.note.simpleadmin.entity.TbGoodsSpec;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/***
 *@ClaseName:ClassifyRepository
 *
 *@Decription:
 *
 *@Author: xubingbing
 *
 *@Date:2019/1/14 0014 10:06
 */
public interface GoodsSpecRepository extends JpaRepository<TbGoodsSpec, String>, JpaSpecificationExecutor<TbGoodsSpec> {
    List<TbGoodsSpec> findByGoodsId(String id);
    @Transactional
    void deleteByGoodsIdAndIdNotIn(String goodId,List<String> id);
    @Transactional
    @Modifying
    @Query("update TbGoodsSpec  set isDelete = ?1 where goodsId=?2")
    void delete(Integer isDelete,String goodsId);
}
